<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <div></div>


    <script>

        // 
        // function noRepeat(arr) {
        //     const arr2 = [];
        //     arr.forEach((v) => {
        //         if (!arr2.includes(v)) {
        //             arr2.push(v)
        //         }
        //     })
        //     return arr2
        // }



        // const arr = [1, 2, 3, 1, 2, 3, 12, 1, 2];
        // // arr.push(4)

        // const arr2 = noRepeat(arr);
        // //
        // console.log(arr2);


        Array.prototype.noRepeat = function () {
            const arr2 = [];
            this.forEach((v) => {
                if (!arr2.includes(v)) {
                    arr2.push(v)
                }
            })
            return arr2
        }


        const arr = [1, 2, 3, 1, 2, 3, 12, 1, 2];

        console.log(arr.noRepeat());

        console.log(arr);




        // 给日期对象添加一个方法   格式化日期
        Date.prototype.format = function () {
            const y = this.getFullYear();
            const m = this.getMonth() + 1;
            const d = this.getDate();
            const h = this.getHours();
            const min = this.getMinutes();
            const s = this.getSeconds();
            return `${y}/${m}/${d} ${h}:${min}:${s}`
        }







        const date = new Date();
        console.log(date.format());




    </script>

</body>

</html>